package com.lagou.myrpcconsumer.controller;

import com.lagou.myrpcconsumer.server.UserServer;
import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户请求类
 * @Author: zj
 * @Description:
 * @Date: 2021/8/4 0004 下午 19:57
 * @Version: 1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserServer iUserService;

    @RequestMapping("/getById/{id}")
    public User getUserById(@PathVariable int id){
        User user = iUserService.getIUserService().getById(id);
        System.out.println(user.toString());
        return user;
    }
}
